﻿
using Dora.Orm.SqlSugarCore.UnitOfWork;
using Dora.Services.AdminUser.Dto.QueryDto;
using Dora.Services.AdminUser.Entities;
using Dora.Services.AdminUser.IApplication;
using Dora.Services.AdminUser.Repository.Repositorys;
using Dora.Services.AdminUser.Application.Base;
using Dora.Tools.Utility.Const;
using Microsoft.Extensions.Logging;
using Surging.Core.Common;
using Surging.Core.CPlatform.Ioc;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Dora.Services.AdminUser.Dto.ViewDto;

namespace Dora.Services.AdminUser.Application
{
    /// <summary>
    /// sms发送记录表服务
    /// </summary>
    [ModuleName(DoraModuleName.AdminUser)]
    public class SmsRecordService : DoraServiceBase, ISmsRecordService
    {
        
        private ISugarUnitOfWork _unitOfWork;
        private readonly SmsRecordRepository _repository;
        public SmsRecordService(ISugarUnitOfWork unitOfWork)
        {
            _unitOfWork = unitOfWork;
            _repository = new SmsRecordRepository(unitOfWork);
        }

        /// <summary>
        /// 分页获取数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PageDataList<SmsRecordViewDto>> GetPageList(SmsRecordQueryDto input)
        {
            var page = await _repository.GetPageList(input);
            return page;
        }

        /// <summary>
        /// 分页获取组织机构统计短信发送数量数据
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<PageDataList<SmsRecordOrgStaticsViewDto>> GetOrgStaticsPageList(SmsRecordOrgStaticsQueryDto input)
        {
            var page = await _repository.GetOrgStaticsPageList(input);
            return page;
        }
    }
}
